package com.audaque.springboot.foshanupload.mbmul.config.db1;


import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

/**
 * @author zgb
 * @desc 待认领的数据库数据源
 * 如果开发人员配置了多个数据源，那么 Spring Boot 中 DataSource 和 Mybatis 的自动配置类将不会再生效。
 * @date 2022-07-17 21:12:47
 */

@Configuration
@ConditionalOnProperty(value = "switch.mbmul", havingValue = "true", matchIfMissing = false)
public class Db1DataSourceConfig {
    private static final String DATASOURCE_PREFIX = "spring.datasource.db1";



    @Bean
    @ConfigurationProperties(prefix = DATASOURCE_PREFIX)
    public DataSource db1DataSource() {
        return DataSourceBuilder.create().build();
    }


}
